﻿
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>管理员登陆</title>
    <script src="@Url.Content("~/CommonResource/Js/jquery-1.8.3.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/CommonResource/Js/jquery.cookie.js")" type="text/javascript"></script>
    <style type="text/css">
        * {
            padding: 0;
            margin: 0;
            border: 0;
        }

        ul, ol, li {
            list-style: none;
        }

        body {
            width: 1300px;
            margin: 0 auto;
            background-color: #bfbfbf;
        }

        img {
            border: none;
        }

        a {
            text-decoration: none;
            outline: none;
        }

        .top {
            width: 1300px;
            height: 106px;
            background: url(/Areas/AdminMrg/Content/adminImg/M_pageTopBg.jpg) no-repeat;
        }

        .content {
            width: 1300px;
            height: 613px;
            background: url(/Areas/AdminMrg/Content/adminImg/M_loginBg.gif) no-repeat;
        }

            .content .loginBox {
                width: 620px;
                height: 205px;
                position: absolute;
                margin-left: 350px;
                margin-top: 158px;
            }

                .content .loginBox .left {
                    width: 225px;
                    height: 160px;
                    float: left;
                    margin-top: 23px;
                    margin-left: 172px;
                    display: inline;
                }

                    .content .loginBox .left .userName {
                        width: 225px;
                        height: 28px;
                        margin-top: 29px; /*width: 191px;*/
                    }

                    .content .loginBox .left .userPwd {
                        width: 225px;
                        height: 28px;
                        margin-top: 10px;
                    }

                    .content .loginBox .left .userCode {
                        width: 225px;
                        height: 28px;
                        margin-top: 10px;
                    }

                    .content .loginBox .left .inputs {
                        width: 191px;
                        height: 24px;
                        background-color: #fff;
                        float: left;
                    }

                    .content .loginBox .left .tips {
                        width: 34px;
                        height: 24px;
                        float: left;
                        line-height: 25px;
                        color: #f00;
                    }

                    .content .loginBox .left .userCode .code {
                        width: 100px;
                        height: 28px;
                        float: left;
                    }

                    .content .loginBox .left .userCode .codeImg {
                        width: 80px;
                        float: left;
                        margin-left: 10px;
                        display: inline;
                    }

                .content .loginBox .right {
                    float: left;
                    width: 216px;
                    height: 205px;
                }

            .content .errorBox {
                width: 420px;
                height: 30px;
                position: absolute;
                margin-left: 400px;
                margin-top: 358px;
                color: red;
                text-align: center;
            }

        .loginbtn {
            background: none;
            outline: none;
            cursor: pointer;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            $("#btnLogin").click(function () {
                
                var name = $.trim($("#userName").val());
                var pwd = $.trim($("#userPwd").val());
                var code = $.trim($("#verifyCode").val());
                var codeCookie = $.cookie("VerifyCode");//cookie
                if (name == "") {
                    alert("请输入用户名");
                    return false;
                }
                if (pwd == "") {
                    alert("请输入密码");
                    return false;
                }
                if (code == "") {
                    alert("请输入验证码");
                    return false;
                }
                if (code.toUpperCase() != codeCookie) {
                    alert("请输入正确的验证码");
                    return false;
                }
                var params = {};
                params.account = name;
                params.pwd = pwd;
                $.ajax({
                    url: "/Account/PostLogin",
                    type: "POST",
                    dataType: "json",
                    data: params,
                    success: function (msg) {
                        if (msg.OperateResult == "操作成功") {
                            window.location.href = "/AdminMrg/MCompany/Index";
                        }
                        if (msg.OperateResult == "操作失败") {
                            if (msg.ResponseData != undefined && msg.ResponseData != "") {
                                alert("网络错误" + msg.ResponseData);
                            }
                            else {
                                alert("网络错误");
                            }
                        }
                    },
                    error: function (msg) {
                        $.MessageBox.ShowMsgAndAutoClose({ msg: "注册失败" });
                    }
                });
            });
        });
    </script>
</head>
<body>
    <div class="top"></div>
    <div class="content">
        <div class="loginBox">
            @using (Html.BeginForm())
            {
                <div class="left">
                    <div class="userName">
                        <input type="text" class="inputs" id="userName">
                    </div>
                    <div class="userPwd">
                        <input type="text" class="inputs" id="userPwd">
                    </div>
                    <div class="userCode">
                        <div class="code">
                            <input type="text" class="inputs" id="verifyCode" style="width:100px">
                        </div>
                        <div class="codeImg">
                            <img width="80" height="27" src="@Url.Content("~/Ashx/VerifyCodeImage.ashx")" onclick="this.src=this.src+'?'" />
                        </div>
                    </div>
                </div>
                <div class="right">
                    <input id="btnLogin" type="button" value="" class="loginbtn" style="width: 220px; height: 205px" />
                </div>
            }
        </div>
        <div class="errorBox">@Html.ValidationSummary(true, "")</div>
    </div>    
</body>
</html>
